﻿Public Class Conversion_Tools(Of t)

    Public Shared Function ConvArrToByte(ByVal arrtoconvert() As t) As Byte()
        Dim character As t
        Dim result(arrtoconvert.Count - 1) As Byte
        Dim i As Integer = 0

        For Each character In arrtoconvert

            result(i) = Convert.ToByte(character)
            i += 1

        Next

        Return result
    End Function

    Public Shared Function ConvArrFromByte(ByVal arrtoconvert() As Byte) As String
        Dim character As Byte
        Dim result As String = String.Empty

        For Each character In arrtoconvert
            If Not character = 0 Then
                result += Convert.ToChar(character)
            Else
                Exit For
            End If
        Next

        Return result
    End Function

End Class
